<%-- 
    Document   : Admin
    Created on : Dec 2, 2013, 5:40:47 PM
    Author     : NamDH
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">



<html lang="en">
  <head>
      <c:if test="${empty sessionScope.ACCOUNT}">
          <c:redirect url="../login.jsp"/>
      </c:if>
      <c:if test="${sessionScope.ACCOUNT.role.roleID == 3}">
            <c:redirect url="../home.jsp"/>
        </c:if>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <title>PRTS - Admin Page</title>

    <!-- Bootstrap core CSS -->
    <link href="css/bootstrap.css" rel="stylesheet">

    <!-- Add custom CSS here -->
    <link href="css/sb-admin.css" rel="stylesheet">
    <link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
    <!-- Page Specific CSS -->
    <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.3.min.css">

  </head>

  <body>

    <div id="wrapper">

      <!-- Sidebar -->
      <nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
            <div id ="logo" style="float:left; padding:3px">
                <a href="../home.jsp">
                 <img style="height: 80px" src="../Images/PRTS.png"/>
                 </a>
            </div>

           <div  style="color:white; font-size: 3em;margin: 20px 0 0 70px; float:left;">
               <span>Admin Page</span>
           </div>

        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse navbar-ex1-collapse">

          <ul class="nav navbar-nav side-nav">
              <li><a href="../home.jsp"><i class="fa fa-home"></i> Home page</a></li>
            <li class="active" ><a href="Admin.jsp"><i class="fa fa-dashboard"></i> Dashboard</a></li>
            <li><a href="../AdminController?btAction=loadUser"><i class="fa fa-users"></i> Users</a></li>
            <li><a href="../AdminController?btAction=loadProduct"><i class="fa fa-tags"></i> Products</a></li>
            <li><a href="TimeInterval.jsp"><i class="fa fa-clock-o"></i> Edit time interval</a></li>

          </ul>

          <ul class="nav navbar-nav navbar-right navbar-user">


            <li id="dropdown-account" class="dropdown user-dropdown" style="max-height: 85px">
              <a href="#" id="username-outer" class="dropdown-toggle" data-toggle="dropdown"> ${sessionScope.ACCOUNT.emailAddress} <b class="caret"></b></a>
              <ul class="dropdown-menu">
                  <li><a href="../home.jsp"><i class="fa fa-home"> </i> Home page</a></li>
                <li><a href="../HomeController?btAction=logout"><i class="fa fa-power-off"></i> Log Out</a></li>
              </ul>
            </li>
          </ul>
        </div><!-- /.navbar-collapse -->
      </nav>

      <div id="page-wrapper">

        <div class="row">
          <div class="col-lg-12">
            <h1>Dashboard </h1>
            <ol class="breadcrumb">
              <li class="active"><i class="fa fa-dashboard"></i> Dashboard</li>
            </ol>
            <div class="alert alert-success alert-dismissable">
              <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
              Welcome to Admin Page!
            </div>
          </div>
        </div>
  

        <div class="row">
          <div class="col-lg-4">
            <div class="panel panel-info">
              <div class="panel-heading">
                <div class="row">
                  <div class="col-xs-6">
                    <i class="fa fa-users fa-5x"></i>
                  </div>
                  <div class="col-xs-6 text-right">
                      <p class="announcement-heading">${sessionScope.ACCCOUNT}</p>
                    <p class="announcement-text">Users!</p>
                  </div>
                </div>
              </div>
              <a href="../AdminController?btAction=loadUser">
                <div class="panel-footer announcement-bottom">
                  <div class="row">
                    <div class="col-xs-6">
                        View user list!
                    </div>
                    <div class="col-xs-6 text-right">
                      <i class="fa fa-arrow-circle-right"></i>
                    </div>
                  </div>
                </div>
              </a>
            </div>
          </div>
      
          <div class="col-lg-4">
            <div class="panel panel-danger">
              <div class="panel-heading">
                <div class="row">
                  <div class="col-xs-6">
                    <i class="fa fa-desktop fa-5x" style="margin: 10px 0 0 0;"></i>
                  </div>
                  <div class="col-xs-6 text-right">
                      <p class="announcement-heading">${sessionScope.TPCOUNT}</p>
                    <p class="announcement-text">Tracked products!</p>
                  </div>
                </div>
              </div>
              <a href="../AdminController?btAction=loadProduct">
                <div class="panel-footer announcement-bottom">
                  <div class="row">
                    <div class="col-xs-6">
                      View tracked product!
                    </div>
                    <div class="col-xs-6 text-right">
                      <i class="fa fa-arrow-circle-right"></i>
                    </div>
                  </div>
                </div>
              </a>
            </div>
          </div>
          <div class="col-lg-4">
            <div class="panel panel-success">
              <div class="panel-heading">
                <div class="row">
                  <div class="col-xs-6">
                    <i class="fa fa-comments fa-5x"></i>
                  </div>
                  <div class="col-xs-6 text-right">
                      <p class="announcement-heading">${sessionScope.FBCOUNT}</p>
                    <p class="announcement-text"> Feedbacks!</p>
                  </div>
                </div>
              </div>
              <a href="../FeedbackController?btAction=ShowFeedback">
                <div class="panel-footer announcement-bottom">
                  <div class="row">
                    <div class="col-xs-6">
                      Read feedbacks!
                    </div>
                    <div class="col-xs-6 text-right">
                      <i class="fa fa-arrow-circle-right"></i>
                    </div>
                  </div>
                </div>
              </a>
            </div>
          </div>
        </div> 

        <div class="row">
          <div class="col-lg-6">
            <div class="panel panel-primary">
              <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-users"></i> Users</h3>
              </div>
              <div class="panel-body">
                  <div class="table-responsive">
                  <table class="table table-bordered table-hover table-striped tablesorter">
                      <thead>
                          <tr>
                              <th class="header">Email</th>
                              <th class="header">Sign up date</th>
                          </tr>
                      </thead>
                      <tbody>
                          <c:set var="dbAccounts" value="${sessionScope.DBACCOUNT}"/>
                          <c:forEach var="dbAccount" items="${dbAccounts}">
                               <tr>
                              <td style="max-width: 120px"><div  style="overflow: hidden; white-space: nowrap; text-overflow:ellipsis">${dbAccount.emailAddress}</div></td>
                              <td style="max-width: 110px"><div  style="overflow: hidden; white-space: nowrap; text-overflow:ellipsis">${dbAccount.signupDate}</div></td>

                          </tr>
                          </c:forEach>
                         
                      </tbody>
                  </table>
                      </div>
              </div>
            </div>
          </div>
            <div class="col-lg-6">
            <div class="panel panel-primary">
              <div class="panel-heading">
                <h3 class="panel-title"><i class="fa fa-dollar"></i> Products</h3>
              </div>
              <div class="panel-body">
                    <div class="table-responsive">
                  <table class="table table-bordered table-hover table-striped tablesorter">
                      <thead>
                          <tr>
                              <th class="header">Product name</th>
                              <th class="header">Tracked date</th>
                          </tr>
                      </thead>
                      <tbody>
                          <c:set var="dbTrackedProducts" value="${sessionScope.DBTRACKEDPRODUCT}"/>
                          <c:forEach var="dbTrackedProduct" items="${dbTrackedProducts}">
                               <tr>
                              <td style="max-width: 120px"><div  style="overflow: hidden; white-space: nowrap; text-overflow:ellipsis">${dbTrackedProduct.productName}</div></td>
                              <td style="max-width: 110px"><div  style="overflow: hidden; white-space: nowrap; text-overflow:ellipsis">${dbTrackedProduct.trackedDate}</div></td>

                          </tr>
                          </c:forEach>

                      </tbody>
                  </table>
                      </div>
              </div>
            </div>
          </div>
       
       </div>          

   

      </div><!-- /#page-wrapper -->

    </div><!-- /#wrapper -->

    <!-- JavaScript -->
    <script src="../js/jquery-1.8.3.min.js"></script>
    <script src="js/bootstrap.js"></script>

    <!-- Page Specific Plugins -->
    <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
    <script src="http://cdn.oesmith.co.uk/morris-0.4.3.min.js"></script>
    <script src="js/morris/chart-data-morris.js"></script>
    <script src="js/tablesorter/jquery.tablesorter.js"></script>
    <script src="js/tablesorter/tables.js"></script>

  </body>
</html>

